<?php

namespace App\Library\Junda\src;

use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\AddShortUrlResponseBody\data;
use App\Library\Junda\JunDaApiClient;

class EquipmentService extends JunDaApiClient
{

    /**
     *  添加设备
     * @param $mid
     * @param $name
     * @param $location
     * @return mixed
     */
    public static function AddEquipment($mid,$name,$location)
    {
        $url = 'https://apiv2.ljda.net/api/AddEquipment';
        $response = JunDaApiClient::sendRequest($url,'POST',json_encode(['mID'=>$mid,'name'=>$name,'location'=>$location]));
        return $response;
    }

    /**
     *  修噶设备名称
     * @param $mid
     * @param $name
     * @return mixed
     */
    public static function UpdateEquipName($mid,$name)
    {
        $url = 'https://apiv2.ljda.net/api/UpdateEquipName';
        $response = JunDaApiClient::sendRequest($url,'POST',json_encode(['mid'=>$mid,'name'=>$name]));
        return $response;
    }
    /**
     * 终端列表
     * @return void
     */
    public static function GetEquipmentList()
    {
        //get
        $url = 'https://apiv2.ljda.net/api/GetEquipmentList';
       //  https://apiv2.ljda.net/api/GetEquipmentList?start_no=START_NO&mid=mid
        $response = JunDaApiClient::sendRequest($url,'GET',[]);
        return $response;
    }

    /**
     *  查询终端在线状态 001
     * @param $equipmentId
     * @return mixed
     */
    public static function GetOnlineStatusById($equipmentId)
    {
        $url = 'https://apiv2.ljda.net/api/GetOnlineStatusById';
        $response = JunDaApiClient::sendRequest($url,'GET',['equipment_id'=>$equipmentId]);
        return $response;
    }

    /**
     * 查询终端在线状态 002
     * @param $mid
     * @return mixed
     */
    public static function GetOnlineStatusByMid($mid)
    {
        $url = 'https://apiv2.ljda.net/api/GetOnlineStatusByMid';
        $response = JunDaApiClient::sendRequest($url,'GET',["mid"=>$mid]);
        return $response;
    }
    /**
     * 查询指定终端的消费详情
     * equipment_id    是    指定的终端Id
     * start_no    否    开始拉取的序号，不填默认从头开始拉取
     * count    否    本次获取数量,默认是最大值1000.
     * is_asc    否    是否日期升序排列,默认false.
     * @return void
     */
    public function GetEquipmentConsume($equipmentId)
    {
        //get
        $url = 'https://apiv2.ljda.net/api/GetEquipmentConsume';
        $response = JunDaApiClient::sendRequest($url,'GET',["equipment_id"=>$equipmentId]);
        return $response;
    }

    /**
     *  基础参数查询
     * @param $eqid
     * @return mixed
     */
    public static function GetEquipmentParam($eqid)
    {
        $url = "https://apiv2.ljda.net/api/GetEquipmentParam?eqid=".$eqid;
        $response = JunDaApiClient::sendRequest($url,'GET',[]);
        return $response;
    }
    /**
     *  费率参数查询询
     * @param $eqid
     * @return mixed
     */
    public static function GetEquipmentFeeParam($eqid)
    {
        $url = "https://apiv2.ljda.net/api/GetEquipmentFeeParam";
        $response = JunDaApiClient::sendRequest($url,'GET',['eqid'=>$eqid]);
        return $response;
    }
    /**
     *  保存费率参数
     * @param $eqid
     * @return mixed
     */
    public static function SaveEquipmentFeeParam($data)
    {
        $url = "https://apiv2.ljda.net/api/SaveEquipmentFeeParam";
        $response = JunDaApiClient::sendRequest($url,'POST',json_encode($data));
        return $response;
    }
    /**
     *  售水参数查询
     * @param $eqid
     * @return mixed
     */
    public static function GetEquipmentSealWaterParam($eqid)
    {
        $url = "https://apiv2.ljda.net/api/GetEquipmentSealWaterParam";
        $response = JunDaApiClient::sendRequest($url,'GET',['eqid'=>$eqid]);
        return $response;
    }
    /**
     *  保存 售水参数查询
     * @param $eqid
     * @return mixed
     */
    public static function SaveEquipmentSealWaterParam($data)
    {
        $url = "https://apiv2.ljda.net/api/SaveEquipmentSealWaterParam";
        $response = JunDaApiClient::sendRequest($url,'POST',json_encode($data));
        return $response;
    }
    /**
     *  售水参数查询
     * @param $eqid
     * @return mixed
     */
    public static function GetEquipmentPurifyWaterParam($eqid)
    {
        $url = "https://apiv2.ljda.net/api/GetEquipmentPurifyWaterParam";
        $response = JunDaApiClient::sendRequest($url,'GET',['eqid'=>$eqid]);
        return $response;
    }
    /**
     *  保存 售水参数查询
     * @param $eqid
     * @return mixed
     */
    public static function SaveEquipmentPurifyWaterParam($data)
    {
        $url = "https://apiv2.ljda.net/api/SaveEquipmentPurifyWaterParam";
        $response = JunDaApiClient::sendRequest($url,'POST',json_encode($data));
        return $response;
    }

    /**
     *  下发终端第三方消费 01
     * @param $eqid
     * @return mixed
     */
    public static function IssueOnlineConsume($equipment_id,$money,$orderNo)
    {
        $url = "https://apiv2.ljda.net/api/IssueOnlineConsume";
        $response = JunDaApiClient::sendRequest($url,'GET',['equipment_id'=>$equipment_id,'money'=>$money,'orderNo'=>$orderNo]);
        return $response;
    }
    /**
     *  检测设备状态是否可以消费 00
     * @param $eqid
     * @return mixed
     */
    public static function CheckEqBeforePay($equipment_id)
    {
        $url = "https://apiv2.ljda.net/api/CheckEqBeforePay";
        $response = JunDaApiClient::sendRequest($url,'POST',json_encode(['eqid'=>$equipment_id]));
        return $response;
    }


}
